package com.qf.first.service.impl;

import com.qf.first.dao.FoodMapper;
import com.qf.first.entity.Food;
import com.qf.first.service.FoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FoodServiceImpl implements FoodService {
    @Autowired
    private FoodMapper foodMapper;

    @Override
    public List<Food> findFoodsByCategoryId(Long categoryId) {
        List<Food> foodslist = foodMapper.findFoodsByCategoryId(categoryId);
        return foodslist;
    }

    @Override
    public String addFood(Food food) {
        foodMapper.addFood(food);
        return "添加成功";
    }

    @Override
    public String deleteFood(Food food) {
        foodMapper.deleteFood(food);
        return "删除成功";
    }
}
